package com.example.Tousu.controller;

import com.example.Tousu.Bo.addTousuBo;
import com.example.Tousu.domain.Tousu;
//import com.example.Tousu.domain.TousuStasus;
import com.example.Tousu.service.ITousuService;
import com.example.comon.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/tousu")
@Api(value = "tousu",tags = "投诉管理")
public class TousuController {

    @Autowired
    private ITousuService tousuService;
    @GetMapping("/getTousuList")
    @ApiOperation("获取投诉详情")
    public R<List<Tousu>> selectTousu(addTousuBo bo){
        Tousu tousu = new Tousu();
        tousu.setId(bo.getId());
        List<Tousu> list =  tousuService.selectTousu(tousu);
        return R.success(list);
    }
    @PostMapping("/addTousu")
    @ApiOperation("增加投诉")
    public R<Tousu> addTousu(@RequestBody Tousu tousu){
        tousuService.insertTousu(tousu);
        return R.success(tousu);
    }
    @PostMapping("/updateTousuById")
    @ApiOperation("修改投诉")
    public R updateTousuById(@RequestBody Tousu tousu){
        tousuService.updateTousuById(tousu);
        return R.success();
    }
//    @PostMapping("/updateStasusById")
//    @ApiOperation("修改投诉状态")
//    public R updateStasusById(@RequestBody TousuStasus tousuStasus){
//
//        tousuService.updateStasusById(tousuStasus);
//        return R.success();
//    }
    @DeleteMapping("/delTousuById")
    @ApiOperation("删除投诉")
    public R delTousuById(String id){
        tousuService.delTousuById(id);
        return R.success();
    }
}
